﻿@model GPS.ENTITYS.ViewModelQLDBCI_Log
@using PagedList.Mvc;
@using GPS.Helpers;
@{
    ViewBag.Title = "Tra cứu lịch sử phê duyệt báo cáo I";
}

<script src="~/Scripts/jquery.validate.min.js"></script>
<script src="~/Scripts/jquery.validate.unobtrusive.min.js"></script>
<script src="~/Scripts/jquery.maskedinput.js"></script>
<script src="~/Scripts/datepicker.js"></script>
<style>
    .evenClick a img {
        width: 20px;
        height: 20px;
    }
</style>

<div class="container fdb-div-content fdb-div-corner-all">
    <h3 class="text-center fdb-title-search-form">Tra cứu lịch sử phê duyệt báo cáo I</h3>
    <div class="row" id="page">
        @using (Html.BeginForm("Search_Log", "GPS_QuanLyBaoCaoI", FormMethod.Get))
        {
            <div class="row">
                <div class="list-group">
                    <fieldset class="fs_body">
                        <input type="hidden" id="CheckUser" value="@ViewBag.checkuser" />
                        <input type="hidden" id="Message" value="@ViewBag.Message" />
                        <legend class="head_title">Điều kiện tìm kiếm</legend>
                        <div class="row margin-top-05">
                            <div class="col-md-2 control-label">
                                Đơn vị đào tạo:
                            </div>
                            <div class="col-md-4">
                                @*@Html.TextBoxFor(model => model.pBCI_DVGTVT_MA, new { @class = "form-control", @id = "DVGTVT_MA" })*@
                                @Html.DropDownListFor(model => model.pBCI_DVGTVT_MA, (SelectList)ViewBag.DVGTVT_MAs, "---Lựa chọn--", new { @class = "form-control", @id = "DVGTVT_MA" })
                                @*<span id="rDataDVGTVT_MA" style="width:500px;"></span>*@
                                @Html.ValidationMessageFor(model => model.pBCI_DVGTVT_MA)
                                <div class="help-tip">
                                    <p>Gõ mã hoặc Tên Đơn vị  để hiển thị danh sách đơn vị </p>
                                </div>
                            </div>

                            <div class="col-md-2 control-label">
                                Khóa học:
                            </div>
                            <div class="col-md-4">
                                @*@Html.TextBoxFor(model => model.pBCI_KH_MA, new { @class = "form-control", @id = "KH_MA" })*@
                                @Html.DropDownListFor(model => model.pBCI_KH_MA, (SelectList)ViewBag.KH_MAs, string.Empty, new { @title = "form-control", @id = "KH_MA", @style = "font-weight:bold;width:300px" })
                                @*<span id="rDataHV_KH_MA" style="width:500px"></span>*@
                                @Html.ValidationMessageFor(model => model.pBCI_KH_MA)
                                <div class="help-tip">
                                    <p>Gõ mã hoặc tên khóa học để hiển thị danh sách khóa học </p>
                                </div>
                            </div>
                        </div>

                        <div class="row margin-top-05">
                            <div class="col-md-2 control-label">
                                Mã báo cáo I:
                            </div>
                            <div class="col-md-4">
                                @Html.TextBoxFor(model => model.pBCI_MA, new { @class = "form-control" })
                            </div>
                            <div class="col-md-2 control-label">
                                Trạng thái
                            </div>
                            <div class="col-md-4 control-txt">
                                @Html.DropDownListFor(model => model.pBCI_TRANGTHAI, new List<SelectListItem>
                                {
                                    new SelectListItem() {Text = "-- Lựa Chọn --", Value=""},
                                    new SelectListItem() {Text = "Chưa phê duyệt", Value="0"},
                                    new SelectListItem() {Text = "Phê duyệt", Value="1"}
                                }, new { @class = "form-control" })
                            </div>
                        </div>
                        <div class="row margin-top-05">
                            <div class="col-md-2 control-label">
                                Ngày phê duyệt:
                            </div>
                            <div class="col-md-1 control-label">
                                Từ ngày:
                            </div>
                            <div class="col-md-3">
                                @Html.TextBoxFor(model => model.pBCI_TUNGAY, "{0:dd/MM/yyyy}", new { @class = "form-control" })
                                @*@Html.EditorFor(model => model.pBCI_TUNGAY, "{0:dd/MM/yyyy}", new { @class = "form-control" })*@
                            </div>
                            <div class="col-md-2 control-label">
                                Đến ngày:
                            </div>
                            <div class="col-md-4">
                                @Html.TextBoxFor(model => model.pBCI_DENNGAY, "{0:dd/MM/yyyy}", new { @class = "form-control" })
                                @*@Html.EditorFor(model => model.pBCI_DENNGAY, "{0:dd/MM/yyyy}", new { @class = "form-control" })*@
                            </div>
                        </div>
                        <div class="row margin-top-05 btn_search">

                            <button type="submit" id="btnSearch" class="btn btn-warning btn-sm" name="SearchButton" value="Search" title="Tìm kiếm">
                                <span class="glyphicon glyphicon-search"></span> Tìm kiếm
                            </button>
                        </div>
                    </fieldset>
                </div>
            </div>
        }
        <div class="row">
            <fieldset class="fs_body">
                <legend class="head_title">Kết quả tìm kiếm</legend>
                <div class="row margin-top-05">
                    <div class="divbtnFielset">
                        <div style="float: right;">
                            <label id="lblMessageChange" style="color:blue; font-weight:bold">@TempData["ThongBao"]</label> &nbsp;&nbsp;&nbsp;
                            <br />
                            <label id="lblMessageTotal" style="color:blue; font-weight:bold">Tổng số bản ghi: @ViewBag.TotalRow</label>
                        </div>

                    </div>
                </div>

                <div class="row margin-top-05">
                    <table class="table table-striped table-hover table-bordered table-condensed">
                        <tr>

                            <th>
                                STT
                            </th>
                            <th>
                                Mã báo cáo I
                            </th>
                            <th>
                                Đơn vị đào tạo
                            </th>
                            <th>
                                Khóa học
                            </th>
                            <th>
                                Trạng thái trước PD
                            </th>
                            <th>
                                Trạng thái sau PD
                            </th>
                            <th>
                                Ngày PD
                            </th>
                            <th>
                                Người PD
                            </th>
                            <th>
                                Thao tác
                            </th>
                        </tr>

                        @if (Model.SearchResults != null)
                        {
                            var _char = "#";
                            var _disabled = "";
                            foreach (var item in Model.SearchResults)
                            {
                                <tr>

                                    <td align="center">
                                        @Html.DisplayFor(modelItem => item.STT)
                                        @Html.HiddenFor(modelItem => item.STT)
                                    </td>
                                    <td align="center">
                                        @Html.DisplayFor(modelItem => item.BCI_MA)
                                        @Html.HiddenFor(modelItem => item.BCI_MA)
                                     

                                    </td>
                                 
                                    <td align="left">
                                        @Html.DisplayFor(modelItem => item.DVGTVT_TEN)
                                        @Html.HiddenFor(modelItem => item.BCI_DVGTVT_MA)
                                    </td>
                                    <td align="left">
                                        @*@Html.DisplayFor(modelItem => item.KH_TEN)*@
                                        @Html.HiddenFor(modelItem => item.BCI_KH_MA)
                                        <a href="@Url.Action("BCIDetail", "GPS_QuanLyBaoCaoI", new { BCI_KH_MA = item.BCI_KH_MA, BCI_DVGTVT_MA = item.BCI_DVGTVT_MA })" class="bcidetail" title="Click vào để xem chi tiết">

                                            @item.KH_TEN
                                        </a>
                                    </td>
                                    <td align="center">
                                        @*@Html.DisplayFor(modelItem => item.BCI_SOHV)*@
                                        @Html.DisplayFor(modelItem => item.BCI_TRANGTHAI_OLD)

                                    </td>
                                    <td align="center">
                                        @Html.DisplayFor(modelItem => item.BCI_TRANGTHAI)
                                    </td>
                                    <td align="center">
                                        @Html.DisplayFor(modelItem => item.LOGTIME, "{0:dd/MM/yyyy hh:mm:ss}")
                                    </td>
                                    <td align="center">
                                        @Html.DisplayFor(modelItem => item.USER_LOG)
                                    </td>
                                 
                                    <td align="center">
                                        <div class="evenClick">
                                            <a href="@Url.Action("Detail", "GPS_QuanLyBaoCaoI", new { id = item.BCI_DVGTVT_MA, id1 = item.BCI_KH_MA })" data-modal="">
                                                <img src="@Url.Content("~/fonts/icon/search_file.png")" title="Xem chi tiết học viên - khóa học" />
                                            </a>


                                        </div>
                                    </td>
                                </tr>
                            }
                        }
                    </table>
                </div>

                <div class="row margin-top-05">
                    <div class="pagination-sm">
                        @{
                            if (Model.SearchResults != null)
                            {
                                @Html.PagedListPager(Model.SearchResults, page => Url.Action("Search_Log", new
                                {
                                    page,
                                    Model.pBCI_DVGTVT_MA,
                                    Model.pBCI_KH_MA,
                                    Model.pBCI_MA,
                                    Model.pBCI_TRANGTHAI,
                                    Model.pBCI_TUNGAY,
                                    Model.pBCI_DENNGAY
                                }))
                            }

                        }



                    </div>
                </div>
            </fieldset>
        </div>

    </div>
</div>
<div id="wait" style="display: none; position: absolute; top: 20%; left: 50%; padding: 2px; z-index: 99999">
    <img src="~/fonts/images/loading16.gif" width="65" height="65" />
</div>

<!-- delete modal placeholder-->
<div id='deleteModal' class='modal fade in'>
    <div class="modal-dialog">
        <div class="modal-content">
            <div id='deleteModalContent'></div>
        </div>
    </div>
</div>

<!-- modal placeholder-->
<div id='myModal' class='modal fade in'>
    <div class="modal-dialog">
        <div class="modal-content">
            <div id='myModalContent'></div>
        </div>
    </div>
</div>


<!-- Modal -- Giangtd3 2017-08-26 -->
<!-- Modal Start here-->
<div class="modal fade bs-example-modal-sm" id="pleaseWaitDialog" tabindex="-1"
     role="dialog" aria-hidden="true" data-backdrop="static" style="z-index:9999">
    <div class="modal-dialog modal-sm" style="top:50%">
        <div class="modal-content" style="margin: 0 auto;width:300px">
            <div class="modal-header">
                <h4 class="modal-title">
                    <span class="glyphicon glyphicon-time">
                    </span>Đang xử lý...
                </h4>
            </div>
            <div class="modal-body">
                <div class="progress">
                    <div class="progress-bar progress-bar-info
                    progress-bar-striped active"
                         style="width: 100%">
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


<div id='myModal2' class='modal fade in'>
    <div class="modal-dialog" style="width:80%">
        <div class="modal-content">
            <div id='myModalContent2'></div>
        </div>
    </div>
</div>

<div id='myModal3' class='modal fade in'>
    <div class="modal-dialog" style="width:80%">
        <div class="modal-content">
            <div id='myModalContent3'></div>
        </div>
    </div>
</div>


@section Scripts {
    @Scripts.Render("~/bundles/modalform")
}

<link href="~/Scripts/select2.css" rel="stylesheet" />
<link href="~/Scripts/select2.min.css" rel="stylesheet" />
<script src="~/Scripts/select2.js"></script>

<script type="text/javascript">
    $("#pBCI_TUNGAY").datepicker({
        changeMonth: true,
        changeYear: true,
        dateFormat: 'dd/mm/yy'
    });
    $("#pBCI_DENNGAY").datepicker({
        changeMonth: true,
        changeYear: true,
        dateFormat: 'dd/mm/yy'
    });
    $("#pBCI_TUNGAY").mask("99/99/9999", { placeholder: "dd/mm/yyyy" });
    $("#pBCI_DENNGAY").mask("99/99/9999", { placeholder: "dd/mm/yyyy" });


    toastr.options = {
        "debug": false,
        "positionClass": "toast-top-right",
        "fadeIn": 500,
        "fadeOut": 2000,
        "timeOut": 1000,
        "extendedTimeOut": 1000

    }



</script>

<script type="text/javascript">
    $(document).ready(function () {

        // track enter key
        $("input").bind("keydown", function (event) {
            var keycode = (event.keyCode ? event.keyCode : (event.which ? event.which : event.charCode));
            if (keycode == 13) {
                document.getElementById('btnSearch').click();
                return false;
            } else {
                return true;
            }
        });

    });
</script>

<script type="text/javascript">
    $(document).ready(function () {

        var pageSize = 20;
        var optionListUrl = '@Url.Action("Select2KH_MA_BCI", "GPS_Ajax")';

        $('#KH_MA').select2(
                {
                    ajax: {
                        delay: 50,
                        url: optionListUrl,
                        dataType: 'json',

                        data: function (params) {
                            /// params.page = params.page || 1;
                            return {
                                searchTerm: params.term,// + "#" + $("#DVGTVT_MA").val(),
                                dvgtvt_ma: $("#DVGTVT_MA").val()
                                //pageNumber: params.page results: JSON.parse(data)
                            };
                        },
                        processResults: function (data, params) {

                            return {
                                results: data.Results
                            };
                        }
                    },
                    placeholder: "-- Chọn khóa học --",
                    minimumInputLength: 2,
                    allowClear: true,
                    language: { inputTooShort: function () { return 'Nhập lớn hơn 2 ký tự để tìm kiếm khóa học'; } }
                });

    
    })
</script>








